{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "NSIDC earthdata\n",
    "=============\n",
    "\n",
    "ftp-like program for searching NSIDC databases and retrieving data  \n",
    "This is a wrapper function for entering credentials and running the program  \n",
    "\n",
    "https://wiki.earthdata.nasa.gov/display/EL/How+To+Access+Data+With+Python  \n",
    "https://nsidc.org/support/faq/what-options-are-available-bulk-downloading-data-https-earthdata-login-enabled  \n",
    "http://www.voidspace.org.uk/python/articles/authentication.shtml#base64  \n",
    "\n",
    "Register with NASA Earthdata Login system:  \n",
    "https://urs.earthdata.nasa.gov  \n",
    "\n",
    "Add NSIDC_DATAPOOL_OPS to NASA Earthdata Applications  \n",
    "https://urs.earthdata.nasa.gov/oauth/authorize?client_id=_JLuwMHxb2xX6NwYTb4dRA  \n",
    "\n",
    "COMMAND LINE OPTIONS:  \n",
    "- usage: List the following command line options  \n",
    "- ls: List contents of the remote directory  \n",
    "- cd: Change the remote directory  \n",
    "- lcd: Change the local directory  \n",
    "- mkdir: Create a directory within the local directory  \n",
    "- pwd: Print the current local and remote directory paths\n",
    "- sync: Sync all files in directory with a local directory\n",
    "- rsync: Recursively sync all directories with a local directory\n",
    "- mget: Get all files in directory\n",
    "- get: Get a single file in a directory\n",
    "- verbose: Toggle verbose output of program\n",
    "- checksum: Toggle checksum function within program\n",
    "- exit: Exit program\n",
    "\n",
    "#### PYTHON DEPENDENCIES:\n",
    "- [lxml](https://github.com/lxml/lxml): Pythonic XML and HTML processing library using libxml2/libxslt\n",
    "        \n",
    "#### UPDATE HISTORY:\n",
    "- Updated 05/2018: using python cmd module (line-oriented command interpreter)\n",
    "- Updated 09/2017: updated header text\n",
    "- Written 08/2017"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from __future__ import print_function\n",
    "from earthdata import earthdata\n",
    "\n",
    "#-- run Earthdata program\n",
    "#-- ftp-like program for searching NSIDC databases and retrieving data\n",
    "prompt = earthdata()\n",
    "#-- print introductory message\n",
    "#-- run program until exit or keyboard interrupt\n",
    "prompt.cmdloop(prompt.intro)\n",
    "#-- print goodbye message\n",
    "print(prompt.goodbye)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
